< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03030101.xhp

(section: dateserial) (bookmark: bm_id3157896)
DateSerial function

DateSerial 関数

DateSerial Function [Runtime]
DateSerial 関数 [実行時](hd_id3157896.1)

Returns a Date value for a specified year, month, or day.
指定された年、月、日に該当する、日付 データを返します。(par_id3143267.2)

(/section: dateserial)

Syntax:
構文:(hd_id3147264.3)

DateSerial (year, month, day)
DateSerial (year, month, day)(par_id3149670.4)

Return value:
戻り値:(hd_id3150792.5)

Date
日付(par_id3150398.6)

Parameters:
パラメータ:(hd_id3154141.7)

Year: Integer expression that indicates a year. All values between 0 and 99 are interpreted as the years 1900-1999. For years that fall outside this range, you must enter all four digits.
Year: 年を指定する整数表式。0 から 99 の数値は、1900 から 1999 の該当年として解釈されますが、その他の数値は 4 桁すべてを指定する必要があります。(par_id3147229.8)

Month: Integer expression that indicates the month of the specified year. The accepted range is from 1-12.
Month: 月を指定する整数表式。1 から 12 の数値を指定できます。(par_id3156280.9)

Day: Integer expression that indicates the day of the specified month. The accepted range is from 1-31. No error is returned when you enter a non-existing day for a month shorter than 31 days.
日: 指定された月の日を示す整数式。許容範囲は 1 ~ 31 です。31 日より小さい存在しない日付を入力しても、エラーは返されません。(par_id3151043.10)

The DateSerial function returns the number of days between December 30,1899 and the given date. You can use this function to calculate the difference between two dates.
DateSerial 関数 は、1899 年 12 月 30 日からの経過日数を返します。この関数で得られる数値は、2 つの日付間の日数計算などに利用できます。(par_id3161832.11)

The DateSerial function returns the data type Variant with VarType 7 (Date). Internally, this value is stored as a Double value, so that when the given date is 1.1.1900, the returned value is 2. Negative values correspond to dates before December 30, 1899 (not inclusive).
DateSerial 関数 の返す値は、バリアント型の VarType 7 (Date) です。この値は内部的には倍精度値として格納され、たとえば1900/1/1という日付を指定すると、2 という値が返されます。また、基準日となる 1899 年 12 月 30 日以前の日付 (範囲外の日付) は、負の値として処理されます。(par_id3155306.12)

If a date is defined that lies outside of the accepted range, Office Basic returns an error message.
処理範囲外の日付を指定すると、Office Basic からはエラーメッセージが返されます。(par_id3152576.13)

Whereas you define the DateValue function as a string that contains the date, the DateSerial function evaluates each of the parameters (year, month, day) as separate numeric expressions.
DateValue 関数 では日付を 1 つの文字列として指定するのに対して、DateSerial 関数 の場合は各パラメータ (年、月、日) を、それぞれ個別に評価します。(par_id3149481.14)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

Example:
例:(hd_id3155411.15)

Sub ExampleDateSerial
Sub ExampleDateSerial(par_id3148646.16)

Dim lDate as Long
Dim lDate as Long(par_id3156441.17)

Dim sDate as String
Dim sDate as String(par_id3154791.18)

lDate = DateSerial(1964, 4, 9)
lDate = DateSerial(1964, 4, 9)(par_id3155415.19)

sDate = DateSerial(1964, 4, 9)
sDate = DateSerial(1964, 4, 9)(par_id3147125.20)

msgbox lDate REM returns 23476
msgbox lDate REM 戻り値は 23476(par_id3154942.21)

msgbox sDate REM returns 04/09/1964
msgbox sDate REM は 04/09/1964 を返します(par_id3151074.22)

end sub
end sub(par_id3153878.23)


< Prev / Next >